package cn.itcast.order.controller;


import cn.itcast.hmall.dto.order.OrderReqDTO;
import cn.itcast.hmall.pojo.order.Order;
import cn.itcast.order.service.OrderService;
import org.bouncycastle.pqc.crypto.newhope.NHOtherInfoGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderService orderService;
    @PostMapping
    public String CreateOrder(@RequestBody OrderReqDTO orderReqDTO) {
       // System.out.println(orderReqDTO);
        return     orderService.CreateOrder(orderReqDTO);
    }
    @GetMapping("/{orderId}")
    public Order findOrderById(@PathVariable("orderId") String orderId){
      return   orderService.findOrderById(orderId);
    }
}
